 function getPath(obj,fileQuery,transImg) {

   var imgSrc = '', imgArr = [], strSrc = '' ;

   if(window.navigator.userAgent.indexOf("MSIE")>=1){ // IE浏览器判断
    if(obj.select){
     obj.select();
     var path=document.selection.createRange().text;
     alert(path) ;
     obj.removeAttribute("src");
     imgSrc = fileQuery.value ;
     imgArr = imgSrc.split('.') ;
     strSrc = imgArr[imgArr.length - 1].toLowerCase() ;
     if(strSrc.localeCompare('jpg') === 0 || strSrc.localeCompare('jpeg') === 0 || strSrc.localeCompare('gif') === 0 || strSrc.localeCompare('png') === 0){
      obj.setAttribute("src",transImg);
      obj.style.filter=
       "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path+"', sizingMethod='scale');"; // IE通过滤镜的方式实现图片显示
     }else{
      //try{
      throw new Error('File type Error! please image file upload..'); 
      //}catch(e){
      // alert('name: ' + e.name + 'message: ' + e.message) ;
      //}
     }
    }else{
     // alert(fileQuery.value) ;
     imgSrc = fileQuery.value ;
     imgArr = imgSrc.split('.') ;
     strSrc = imgArr[imgArr.length - 1].toLowerCase() ;
     if(strSrc.localeCompare('jpg') === 0 || strSrc.localeCompare('jpeg') === 0 || strSrc.localeCompare('gif') === 0 || strSrc.localeCompare('png') === 0){
      obj.src = fileQuery.value ;
     }else{
      //try{
      throw new Error('File type Error! please image file upload..') ;
      //}catch(e){
      // alert('name: ' + e.name + 'message: ' + e.message) ;
      //}
     }

    }

   } else{
    var file =fileQuery.files[0];
    var reader = new FileReader();
    reader.onload = function(e){

     imgSrc = fileQuery.value ;
     imgArr = imgSrc.split('.') ;
     strSrc = imgArr[imgArr.length - 1].toLowerCase() ;
     if(strSrc.localeCompare('jpg') === 0 || strSrc.localeCompare('jpeg') === 0 || strSrc.localeCompare('gif') === 0 || strSrc.localeCompare('png') === 0){
      obj.setAttribute("src", e.target.result) ;
     }else{
      //try{
      throw new Error('File type Error! please image file upload..') ;
      //}catch(e){
      // alert('name: ' + e.name + 'message: ' + e.message) ;
      //}
     }

     // alert(e.target.result); 
    }
    reader.readAsDataURL(file);
   }
  }

//function show(){
// //以下即为完整客户端路径
// var file_img=document.getElementById("img"),
//  iptfileupload = document.getElementById('iptfileupload') ;
// getPath(file_img,iptfileupload,file_img) ;
//document.getElementById("srcc").value=document.getElementById("iptfileupload").value;
//}
//function show1(){
// //以下即为完整客户端路径
// var file_img=document.getElementById("img1"),
//  iptfileupload = document.getElementById('iptfileupload1') ;
// getPath(file_img,iptfileupload,file_img) ;
//  document.getElementById("srcc1").value=document.getElementById("iptfileupload1").value;
//}
// function show2(){
// //以下即为完整客户端路径
// var file_img=document.getElementById("img2"),
//  iptfileupload = document.getElementById('iptfileupload2') ;
// getPath(file_img,iptfileupload,file_img) ;
//  document.getElementById("srcc2").value=document.getElementById("iptfileupload2").value;
//}
   
 var maxsize = 2*1024*1024;//2M  
        var errMsg = "上传的附件文件不能超过2M！！！";  
        var tipMsg = "您的浏览器暂不支持计算上传文件的大小，确保上传文件不要超过2M，建议使用FireFox、Chrome浏览器。";  
        var  browserCfg = {};  
        var ua = window.navigator.userAgent;  
        
        if(!!window.ActiveXObject || "ActiveXObject" in window){  
            browserCfg.ie = true;  
        }else if(ua.indexOf("Firefox")>=1){  
            browserCfg.firefox = true;  
        }else if(ua.indexOf("Chrome")>=1){  
            browserCfg.chrome = true;  
        }  
        function checkfile(){  
            try{  
                var obj_file = document.getElementById("iptfileupload");  
                if(obj_file.value==""){  
                    alert("请先选择上传文件");  
                    return;  
                }  
                var filesize = 0;  
                if(browserCfg.firefox || browserCfg.chrome ){  
                    filesize = obj_file.files[0].size;  
                }else if(browserCfg.ie){  
                	
                    var obj_img = document.getElementById('img');  
                    obj_img.dynsrc=obj_file.value;  
                    filesize = obj_img.fileSize;  
                }else{  
                    alert(tipMsg);  
                	return;  
                }  
                if(filesize==-1){  
                    alert(tipMsg);  
                    return;  
                }else if(filesize>maxsize){  
                    alert(errMsg);  
                    return;  
                }else{  
                	
                   var file_img=document.getElementById("img"),
				    iptfileupload = document.getElementById('iptfileupload') ;
				   getPath(file_img,iptfileupload,file_img) ;
				  document.getElementById("srcc").value=document.getElementById("iptfileupload").value; 
                   return;  
                }  
            }catch(e){  
                alert(e);  
            }  
        }
        function checkfile1(){  
            try{  
                var obj_file = document.getElementById("iptfileupload1");  
                if(obj_file.value==""){  
                    alert("请先选择上传文件");  
                    return;  
                }  
                var filesize = 0;  
                if(browserCfg.firefox || browserCfg.chrome ){  
                    filesize = obj_file.files[0].size;  
                }else if(browserCfg.ie){  
                    var obj_img = document.getElementById('img1');  
                    obj_img.dynsrc=obj_file.value;  
                    filesize = obj_img.fileSize;  
                }else{  
                    alert(tipMsg);  
                return;  
                }  
                if(filesize==-1){  
                    alert(tipMsg);  
                    return;  
                }else if(filesize>maxsize){  
                    alert(errMsg);  
                    return;  
                }else{  
                	
                   var file_img=document.getElementById("img1"),
				    iptfileupload = document.getElementById('iptfileupload1') ;
				   getPath(file_img,iptfileupload,file_img) ;
				  document.getElementById("srcc1").value=document.getElementById("iptfileupload1").value; 
                   return;  
                }  
            }catch(e){  
                alert(e);  
            }  
        }
        function checkfile2(){  
            try{  
                var obj_file = document.getElementById("iptfileupload2");  
                if(obj_file.value==""){  
                    alert("请先选择上传文件");  
                    return;  
                }  
                var filesize = 0;  
                if(browserCfg.firefox || browserCfg.chrome ){  
                    filesize = obj_file.files[0].size;  
                }else if(browserCfg.ie){  
                    var obj_img = document.getElementById('img2');  
                    obj_img.dynsrc=obj_file.value;  
                    filesize = obj_img.fileSize;  
                }else{  
                    alert(tipMsg);  
                return;  
                }  
                if(filesize==-1){  
                    alert(tipMsg);  
                    return;  
                }else if(filesize>maxsize){  
                    alert(errMsg);  
                    return;  
                }else{  
                	
                   var file_img=document.getElementById("img2"),
				    iptfileupload = document.getElementById('iptfileupload2') ;
				   getPath(file_img,iptfileupload,file_img) ;
				  document.getElementById("srcc2").value=document.getElementById("iptfileupload2").value; 
                   return;  
                }  
            }catch(e){  
                alert(e);  
            }  
        }